<?php $this->load->view('admin/public/head.html', array('css' => array(
    '/assets/admin/css/admin/common.css'
)));


var_dump($this->detail);

?>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper goodsAdmin" ng-controller="admin-goods-index-controller">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            商品管理
            <small>管理查看商品信息</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/home/index"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li class="active">商品列表</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">商品列表</h3>
                        <?php if($showAddBtn):?>
                        <div class="box-tools">
                            <div class="input-group input-group-sm">
                                <?php if ($role == 'base') :?>
                                <a href="/goods/lists/add" style="background: #00a65a; border: none;" class="btn btn-sm btn-info"><i class="fa fa-plus"></i> 添加商品</a>
                                <?php else :?>
                                <a href="/goods/qqg/add" style="background: #00a65a; border: none;" class="btn btn-sm btn-info"><i class="fa fa-plus"></i> 添加商品</a>
                                <?php endif;?>
                            </div>
                        </div>
                        <?php endif;?>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered">
                            <tr>
                                <th class="text-center" style="width: 30px">#</th>
                                <th class="text-center" style="width: 80px;">缩略图</th>
                                <th class="text-center" style="width: 250px;">商品名称</th>
                                <th class="text-center">基地名称</th>
                                <th class="text-center">价格</th>
                                <th class="text-center">剩余<br>库存</th>
                                <th class="text-center" style="width: 90px;">添加时间</th>
                                <th class="text-center">评论</th>
                                <th class="text-center">状态</th>
                                <th class="text-center" style="width: 60px">操作</th>
                            </tr>
                            <?php if(!empty($goods)) { foreach($goods as $g) {?>
                            <tr>
                                <td class="text-center"><?=$g['id']?></td>
                                <td class="text-center">
                                    <div class="goods-thumb-box">
                                        <img src="<?=$g['thumb']?>" class="goods-thumb" onerror="this.src='/assets/admin/img/nothumb.png'">
                                        <?php if(isset($g['activity']) && $g['activity'] == 1):?>
                                        <div class="goods-thumb-activity"></div>
                                        <?php endif;?>
                                    </div>
                                </td>
                                <td><a href="/goods/lists/edit?goodsId=<?=$g['id']?>"><?=$g['goodsName']?></a></td>
                                <td class="text-center"><?=$g['baseName']?></td>
                                <td class="text-center text-red">
                                    <?php if((empty($g['minPrice']) || empty($g['maxPrice'])) || ($g['minPrice'] == $g['maxPrice'] && $g['maxPrice'] == '0.00')):?>
                                        ￥ <?=$g['price']?>
                                    <?php elseif(($g['minPrice'] == $g['maxPrice']) && $g['price'] == 0):?>
                                        ￥ <?=$g['minPrice']?>
                                    <?php else:?>
                                        零:￥<?=$g['minPrice']?> ~ ￥<?=$g['maxPrice']?>
                                    <?php endif;?>
                                    <br>
                                    采:￥<?=$g['minPurPrice']?> ~ ￥<?=$g['maxPurPrice']?>
                                </td>
                                <td class="text-center"><?=$g['stock']?></td>
                                <td class="text-center"><?=$g['created']?></td>
                                <td class="text-center"><a href="###"><?=$g['comments']?></a></td>
                                <td class="text-center" id="item_<?=$g['id']?>">
                                    <?php if($g['status']): ?>
                                        <span class="badge bg-green">正常</span>
                                    <?php else: ?>
                                        <span class="badge bg-red">下架</span>
                                    <?php endif; ?>
                                </td>
                                <td class="text-center">
                                    <a href="/goods/lists/edit?goodsId=<?=$g['id']?>" class="btn btn-xs btn-link"><i class="fa fa-pencil"></i> 编辑</a>
                                    <a href="javascript:;" class="btn btn-xs btn-link" ng-click="deleteItem(<?=$g['id']?>)"><i class="fa fa-close"></i> 删除</a>
                                    <a href="javascript:;" class="btn btn-xs btn-link" ng-click="changeStatus(<?=$g['id']?>, <?=$g['status']?>)"><i class="fa fa-arrow-down"></i>
                                        <span id="status_<?=$g['id']?>">
                                            <?php if($g['status']):?>
                                            下架
                                            <?php else: ?>
                                            上架
                                            <?php endif;?>
                                        </span>
                                    </a>
                                </td>
                            </tr>
                            <?php }} else { ?>
                                <tr>
                                    <td colspan="10"><p class="help-block text-center">暂无商品</p></td>
                                </tr>
                            <?php }?>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <?=$page?>
                </div>
                <!-- /.box -->
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array('js' => array(
    '/assets/admin/js/goods/index.js'
))); ?>
